import java.util.*;

public class TestStretch {
    public static void main(String[] args) {
        int[] list = {18, 7, 4, 14, 11};
        int[] list2 = stretch(list);
        System.out.println(Arrays.toString(list));  // [18, 7, 4, 24, 11]
        System.out.println(Arrays.toString(list2)); // [9, 9, 4, 3, 2, 2, 7, 7, 6, 5]
    }

    public static int[] stretch(int[] list) {
        int[] temp = new int[list.length * 2];
        int count = 0;
        for (int i = 0; i < list.length; i++) {
            if (list[i] % 2 == 0) {
                temp[count] = list[i] / 2;
                count += 1;
                temp[count] = list[i] / 2;
                count += 1;
            }
            else {
                temp[count] = (list[i] / 2) + 1;
                count += 1;
                temp[count] = list[i] / 2;
                count += 1;
            }
        }
        return temp;
    }
}